home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip: 2005 Utilities
/
CHIP Utilities 2005.7z
/
CHIP Utilities 2005.iso
/
images
/
arachne.igz
/
arachne.img
/
LEVEL1
/
CDROM.CAB
/
bin
/
cdrom.bat
Wrap
DOS Batch File
|
2005-01-16
|
14KB
|
445 lines
@if "%debug%"=="" echo off
if "%1"==":" if not "%2"=="" goto %2
echo CDROM: Starting (version 2.2)
:_start
echo. > %tmp%\_cdrom.tmp
if not exist %ramdrv%\etc\global.set goto _noglob
type %ramdrv%\etc\global.set > %tmp%\_cdrom.tmp
:_noglob
if not exist %ramdrv%\etc\cdrom.set goto _nospec
type %ramdrv%\etc\cdrom.set > %tmp%\_cdrom.tmp
:_nospec
xgrep -sy "^[:s]*@*[:s]*s?e?t?[:s]*CDROM_.+=" %tmp%\_cdrom.tmp > %tmp%\_cdrom.bak
if errorlevel 1 goto _noset
xgrep -sy "^[:s]*@*[:s]*set[:s]+" %tmp%\_cdrom.bak > %tmp%\_cdrom.bat
xgrep -syv "^[:s]*@*[:s]*set[:s]+" %tmp%\_cdrom.bak > %tmp%\_cdrom.tmp
if errorlevel 1 goto _runset
lmod /L* set []< %tmp%\_cdrom.tmp >> %tmp%\_cdrom.bat
:_runset
call %tmp%\_cdrom.bat
:_noset
if "%cdrom_ti%"=="" set cdrom_ti=10
if "%1"=="-c" goto _config
if "%1"=="/c" goto _config
if "%1"=="-h" goto _usage
if "%1"=="/h" goto _usage
if not "nwcache.exe"=="%cache%" goto _okq
echo.
echo CDROM: loading driver aborted
echo.
echo CD-ROM driver should be loaded before cache nwcache.exe.
echo Nwcache.exe is already loaded. To prevent this next time,
echo please move nwcache.%arcext% to dir \level2\.
echo.
@pause
goto _end
:_okq
if "%cdrom_ncfg%"=="1" goto _nocfg
set wcb1=%cdrom_install%
call w.bat box @%ramdrv%\bin\cdrom.bat:w_cfg #2,%cdrom_ti%
if errorlevel 3 goto _end
set cdrom_install=%wcb1%
if errorlevel 2 goto _config
:_nocfg
if "%cdrom_install%"=="1" goto _dothecd
echo CDROM: Skipping CDROM
goto _end
:_dothecd
if exist CDEXUSB1 goto _notagain
if exist CDEXELT1 goto _notagain
if exist CDEXATA1 goto _notagain
if exist CDEXSCS1 goto _notagain
if "%cdrom_ld%"=="5" goto _fixed
if "%cdrom_ld%"=="4" goto _manual
goto _auto
:_manual
echo CDROM: Manual loading mode
echo :w_manual "Manual CD-Rom configuration?" [x]>%tmp%\_cdrom.tmp
echo.>>%tmp%\_cdrom.tmp
:_dmy12
echo [!] Install CDROM >>%tmp%\_cdrom.tmp
echo.>>%tmp%\_cdrom.tmp
echo Use [$ cdrom_drv,1,U]: as the first drive letter for CD-Rom>>%tmp%\_cdrom.tmp
echo.>>%tmp%\_cdrom.tmp
echo [!] Eltorito - requires %srcdrv%\lib\eltorito.%arcext%>>%tmp%\_cdrom.tmp
echo [!] Atapi - requires %srcdrv%\lib\atapi.%arcext%>>%tmp%\_cdrom.tmp
echo [!] USB - requires aspiusb.%arcext%>>%tmp%\_cdrom.tmp
echo [!] Scsi - requires %srcdrv%\lib\aspi.%arcext% (and more)>>%tmp%\_cdrom.tmp
echo.>>%tmp%\_cdrom.tmp
echo [ Ok ] [? Cancel ]>>%tmp%\_cdrom.tmp
set wcb1=%cdrom_elt%
set wcb2=%cdrom_ata%
set wcb3=%cdrom_scs%
set wcb4=%cdrom_usb%
call w.bat box @%tmp%\_cdrom.tmp:w_manual
set cdrom_elt=%wcb1%
set cdrom_ata=%wcb2%
set cdrom_usb=%wcb4%
set cdrom_scs=%wcb3%
if errorlevel 2 goto _end
:_fixed
echo CDROM: Fixed loading mode
if not "%cdrom_elt%"=="1" goto _goatapi
echo CDROM: Loading El-Torito
if not exist %srcdrv%\lib\eltorito.%arcext% %0 : _error missing %srcdrv%\lib\eltorito.%arcext%
if exist %ramdrv%\lib\eltorito.sys goto _torito2
call %ramdrv%\bin\unpack.bat %srcdrv%\lib\eltorito.%arcext%
if not "%unpackerr%"=="" goto _abort
:_torito2
call devhigh %ramdrv%\lib\eltorito.sys /D:CDEXELT1
:_goatapi
if not "%cdrom_ata%"=="1" goto _gousb
echo CDROM: Loading Atapi
if not exist %srcdrv%\lib\atapicd.%arcext% %0 : _error missing %srcdrv%\lib\atapicd.%arcext%
if exist %ramdrv%\lib\vide-cdd.sys goto _fata2
call %ramdrv%\bin\unpack.bat %srcdrv%\lib\atapicd.%arcext%
if not "%unpackerr%"=="" goto _abort
:_fata2
call devhigh %ramdrv%\lib\vide-cdd.sys /D:CDEXATA1
:_gousb
if not "%cdrom_usb%"=="1" goto _goscsi
echo CDROM: Loading USB
if not exist %ramdrv%\bin\usbcd.sys %0 : _error missing %ramdrv%\bin\usbcd.sys
if not exist SCSIMGR$ %0 : _error USB ASPI not loaded
call devhigh %ramdrv%\bin\usbcd.sys /D:CDEXUSB1
:_goscsi
if not "%cdrom_scs%"=="1" goto _noscsi2
echo CDROM: Loading ASPI/SCSI
if not exist %srcdrv%\lib\aspi.%arcext% %0 : _error missing %srcdrv%\lib\aspi.%arcext%
if not exist %srcdrv%\lib\aspicd.%arcext% %0 : _error missing %srcdrv%\lib\aspicd.%arcext%
if not exist %srcdrv%\lib\aspi\*.%arcext% %0 : _error missing %srcdrv%\lib\aspi\*.%arcext%
if exist %ramdrv%\bin\aspi.bat goto _aspi2
call %ramdrv%\bin\unpack.bat %srcdrv%\lib\aspi.%arcext%
if not "%unpackerr%"=="" goto _abort
:_aspi2
call aspi.bat
if "%pci0%"=="_BACK_" goto _noscsi2
if not exist SCSIMGR$ goto _cdex
if exist %ramdrv%\lib\aspicd.sys goto _scsi2
call %ramdrv%\bin\unpack.bat %srcdrv%\lib\aspicd.%arcext%
if not "%unpackerr%"=="" goto _abort
:_scsi2
call devhigh %ramdrv%\lib\aspicd.sys /D:CDEXSCS1
:_noscsi2
goto _cdex
:_auto
echo CDROM: Auto mode
if "%cdrom_ld%"=="3" goto _tryatapi
echo CDROM: Trying El-Torito...
if not exist %srcdrv%\lib\eltorito.%arcext% goto _tryatapi
if not exist %ramdrv%\bin\ifmemdsk.com goto _ettool
%ramdrv%\bin\ifmemdsk.com >%tmp%\nul
if errorlevel 3 goto _eltorito
if errorlevel 2 goto _eltorito
if errorlevel 1 goto _eltorito
:_ettool
if not exist %ramdrv%\bin\ettool.com goto _tryatapi
echo CDROM: Checking boot media type
%ramdrv%\bin\ettool b
if errorlevel 11 goto _tryatapi
if errorlevel 10 goto _eltorito
goto _tryatapi
:_eltorito
if not exist %srcdrv%\lib\eltorito.%arcext% goto _noeltor
echo CDROM: Loading El-Torito
call %ramdrv%\bin\unpack.bat %srcdrv%\lib\eltorito.%arcext%
if not "%unpackerr%"=="" goto _abort
:_torito
call devhigh %ramdrv%\lib\eltorito.sys /D:CDEXELT1
if "%cdrom_ld%"=="2" goto _tryatapi
if errorlevel 1 goto _abort
goto _cdex
:_noeltor
echo CDROM: File %srcdrv%\lib\eltorito.%arcext% not found.
:_tryatapi
echo CDROM: Trying Atapi...
if not exist %srcdrv%\lib\atapicd.%arcext% goto _tryusb
if exist %ramdrv%\lib\vide-cdd.sys goto _atapi1
call %ramdrv%\bin\unpack.bat %srcdrv%\lib\atapicd.%arcext%
if not "%unpackerr%"=="" goto _abort
:_atapi1
call devhigh %ramdrv%\lib\vide-cdd.sys /D:CDEXATA1
if "%cdrom_ld%"=="2" goto _tryusb
if "%cdrom_ld%"=="3" goto _tryusb
if errorlevel 1 goto _tryusb
goto _cdex
:_noatapi
echo CDROM: File %srcdrv%\lib\atapicd.%arcext% not found.
:_tryusb
echo CDROM: Trying USB...
if not exist %ramdrv%\bin\usbcd.sys goto _tryscsi
if not exist SCSIMGR$ goto _tryscsi
call devhigh %ramdrv%\bin\usbcd.sys /D:CDEXUSB1
if "%cdrom_ld%"=="2" goto _tryscsi
if "%cdrom_ld%"=="3" goto _tryscsi
if errorlevel 1 goto _tryscsi
goto _cdex
:_tryscsi
echo CDROM: Trying ASPI/SCSI...
if not exist %srcdrv%\lib\aspi.%arcext% goto _cdex
if exist %ramdrv%\bin\aspi.bat goto _aspi1
call %ramdrv%\bin\unpack.bat %srcdrv%\lib\aspi.%arcext%
if not "%unpackerr%"=="" goto _abort
:_aspi1
call aspi.bat
if "%pci0%"=="_BACK_" goto _cdex
if not exist SCSIMGR$ goto _cdex
if not exist %srcdrv%\lib\aspicd.%arcext% goto _noaspicd
call %ramdrv%\bin\unpack.bat %srcdrv%\lib\aspicd.%arcext%
if not "%unpackerr%"=="" goto _abort
call devhigh %ramdrv%\lib\aspicd.sys /D:CDEXSCS1
:_cdex
if exist CDEXUSB1 goto _cdex1
if exist CDEXELT1 goto _cdex1
if exist CDEXATA1 goto _cdex1
if exist CDEXSCS1 goto _cdex1
echo CDROM: No CD-Rom drivers have been loaded!
goto _abort
:_cdex1
set w_dev=
if exist CDEXELT1 set w_dev=%w_dev% /D:CDEXELT1
if exist CDEXATA1 set w_dev=%w_dev% /D:CDEXATA1
if exist CDEXSCS1 set w_dev=%w_dev% /D:CDEXSCS1
if exist CDEXUSB1 set w_dev=%w_dev% /D:CDEXUSB1
if exist %ramdrv%\bin\nwcdex.exe goto _nwex1
if exist %ramdrv%\bin\mscdex.exe goto _msex1
if exist %ramdrv%\bin\shsucdx.* goto _shex1
if exist %srcdrv%\lib\nwcdex.%arcext% goto _nwex
if exist %srcdrv%\lib\mscdex.%arcext% goto _msex
if exist %srcdrv%\lib\shsucdx.%arcext% goto _shex
echo CDROM: Could not find %srcdrv%\lib\shsucdx.%arcext% or %srcdrv%\lib\mscdex.%arcext%
goto _abort
:_shex
if exist %ramdrv%\bin\shsucdx.* goto _shex1
call %ramdrv%\bin\unpack.bat %srcdrv%\lib\shsucdx.%arcext%
if not "%unpackerr%"=="" goto _abort
:_shex1
:_shex1a
set w_dev=
if "%cachecd%"=="" set cachecd=1024
if not exist CDEXELT1 goto _shex1elt
if not "%cachecd%"=="0" if exist %ramdrv%\bin\cdrcache.sys call devhigh %ramdrv%\bin\cdrcache.sys CDEXELT1 CD$$ELT1 %cachecd%
if exist CD$$ELT1 set w_dev=%w_dev% /D:CD$$ELT1
if not exist CD$$ELT1 set w_dev=%w_dev% /D:CDEXELT1
if not "%cdrom_drv%"=="" set w_dev=%w_dev%,%cdrom_drv%
:_shex1elt
if not exist CDEXATA1 goto _shex1ata
if not "%cachecd%"=="0" if exist %ramdrv%\bin\cdrcache.sys call devhigh %ramdrv%\bin\cdrcache.sys CDEXATA1 CD$$ATA1 %cachecd%
if exist CD$$ATA1 set w_dev=%w_dev% /D:CD$$ATA1
if not exist CD$$ATA1 set w_dev=%w_dev% /D:CDEXATA1
if not "%cdrom_drv%"=="" set w_dev=%w_dev%,%cdrom_drv%
:_shex1ata
if not exist CDEXSCS1 goto _shex1scs
if not "%cachecd%"=="0" if exist %ramdrv%\bin\cdrcache.sys call devhigh %ramdrv%\bin\cdrcache.sys CDEXSCS1 CD$$SCS1 %cachecd%
if exist CD$$SCS1 set w_dev=%w_dev% /D:CD$$SCS1
if not exist CD$$SCS1 set w_dev=%w_dev% /D:CDEXSCS1
if not "%cdrom_drv%"=="" set w_dev=%w_dev%,%cdrom_drv%
:_shex1scs
if not exist CDEXUSB1 goto _shex1usb
if not "%cachecd%"=="0" if exist %ramdrv%\bin\cdrcache.sys call devhigh %ramdrv%\bin\cdrcache.sys CDEXUSB1 CD$$USB1 %cachecd%
if exist CD$$USB1 set w_dev=%w_dev% /D:CD$$USB1
if not exist CD$$USB1 set w_dev=%w_dev% /D:CDEXUSB1
if not "%cdrom_drv%"=="" set w_dev=%w_dev%,%cdrom_drv%
:_shex1usb
:_shex1z
shsucdx%w_dev%
if errorlevel 33 goto _abort
if errorlevel 1 if exist %ramdrv%\bin\shsucdx.exe goto _abort
set w_dev=
goto _autorun
:_nwex
call %ramdrv%\bin\unpack.bat %srcdrv%\lib\nwcdex.%arcext%
if not "%unpackerr%"=="" goto _abort
:_nwex1
if not "%cdrom_drv%"=="" set w_dev=%w_dev% /L:%cdrom_drv%
%ldh% nwcdex%w_dev%
if errorlevel 1 goto _abort
set w_dev=
goto _autorun
:_msex
call %ramdrv%\bin\unpack.bat %srcdrv%\lib\mscdex.%arcext%
if not "%unpackerr%"=="" goto _abort
:_msex1
if not "%cdrom_drv%"=="" set w_dev=%w_dev% /L:%cdrom_drv%
%ldh% mscdex%w_dev%
if errorlevel 1 goto _abort
set w_dev=
:_autorun
set cd1=%cdrom_drv%:
if "%cd1%"==":" set cd1=
set | tfind /f1,2 "W_" >>%tmp%\_cdrom.tmp
set | tfind /f1,6 "CDROM_" >>%tmp%\_cdrom.tmp
type %tmp%\_cdrom.tmp | lmod /L* /B= set [$1]=>%tmp%\_cdrom.bat
call %tmp%\_cdrom.bat
if exist %tmp%\_cdrom.* del %tmp%\_cdrom.*
set wcb1=
set wcb2=
set wcb3=
set wcb4=
set wcb5=
set wcb6=
set wcb7=
set wcb8=
set wcb9=
set wrb=
set wbat=
set ?=
if exist %ramdrv%\bin\cdautrun.bat goto _goautrun
if not exist %srcdrv%\lib\cdautrun.%arcext% goto _nocdautrun
call %ramdrv%\bin\unpack.bat %srcdrv%\lib\cdautrun.%arcext%
if not "%unpackerr%"=="" goto _abort
:_goautrun
%ramdrv%\bin\cdautrun.bat
echo CDROM: Eh, did "%ramdrv%\bin\cdautrun.bat" failed?!?
goto _abort
:_nocdautrun
echo CDROM: File "%srcdrv%\lib\cdautrun.%arcext%" not found... autorun disabled.
goto _end
:_config
echo :w_config "CD-Rom configuration" [x]>%tmp%\_cdrom.tmp
echo.>>%tmp%\_cdrom.tmp
echo Dialog timeout [$ cdrom_ti,3] seconds.>>%tmp%\_cdrom.tmp
echo [!] Skip "Run CD or go config?" dialog>>%tmp%\_cdrom.tmp
echo.>>%tmp%\_cdrom.tmp
:_dmy12
echo [!] Install CDROM >>%tmp%\_cdrom.tmp
echo.>>%tmp%\_cdrom.tmp
echo Use [$ cdrom_drv,1,U]: as the first drive letter for CD-Rom>>%tmp%\_cdrom.tmp
echo.>>%tmp%\_cdrom.tmp
echo Driver loading mode:>>%tmp%\_cdrom.tmp
echo [.] Auto, try to detect best>>%tmp%\_cdrom.tmp
echo [.] Auto, try to detect all>>%tmp%\_cdrom.tmp
echo [.] Auto, try to detect all except Eltorito>>%tmp%\_cdrom.tmp
echo [.] Manual, always ask user>>%tmp%\_cdrom.tmp
echo [.] Fixed, always load:>>%tmp%\_cdrom.tmp
echo [!] Eltorito - requires %srcdrv%\lib\eltorito.%arcext%>>%tmp%\_cdrom.tmp
echo [!] Atapi - requires %srcdrv%\lib\atapi.%arcext%>>%tmp%\_cdrom.tmp
echo [!] USB - requires aspiusb.%arcext%>>%tmp%\_cdrom.tmp
echo [!] Scsi - requires %srcdrv%\lib\aspi.%arcext% (and more)>>%tmp%\_cdrom.tmp
echo.>>%tmp%\_cdrom.tmp
echo [ Save ] [? Cancel ]>>%tmp%\_cdrom.tmp
set wrb=%cdrom_ld%
set wcb1=%cdrom_ncfg%
set wcb2=%cdrom_install%
set wcb3=%cdrom_elt%
set wcb4=%cdrom_ata%
set wcb5=%cdrom_scs%
set wcb6=%cdrom_usb%
call w.bat box @%tmp%\_cdrom.tmp:w_config
set cdrom_ld=%wrb%
set cdrom_ncfg=%wcb1%
set cdrom_install=%wcb2%
set cdrom_elt=%wcb3%
set cdrom_ata=%wcb4%
set cdrom_usb=%wcb6%
set cdrom_scs=%wcb5%
if errorlevel 2 goto _end
set t_out=1
call drd.bat %srcdrv%
if errorlevel 1 set t_out=0
call w.bat box @%ramdrv%\bin\cdrom.bat:w_wprot #1,%t_out%
set t_out=
if errorlevel 2 goto _start
echo CDROM: Saving configuration...
:_dumsave
set | tfind /f1,6 "CDROM_"> %tmp%\_cdrom.bat
if not exist %srcdrv%\etc\*.* mkdir %srcdrv%\etc
if not exist %ramdrv%\etc\global.set goto _yglob
xgrep -syv "^[:s]*@*[:s]*s?e?t?[:s]*CDROM_.+=" %ramdrv%\etc\global.set >> %tmp%\_cdrom.bat
:_yglob
type %tmp%\_cdrom.bat > %srcdrv%\etc\global.set
type %tmp%\_cdrom.bat > %ramdrv%\etc\global.set
if exist %srcdrv%\etc\cdrom.set del %srcdrv%\etc\cdrom.set > %tmp%\nul
if exist %ramdrv%\etc\cdrom.set del %ramdrv%\etc\cdrom.set > %tmp%\nul
echo CDROM: Configuration saved to %srcdrv%\etc\cdrom.set
echo.
@rem pause
if exist CDEXUSB1 goto _end
if exist CDEXELT1 goto _end
if exist CDEXATA1 goto _end
if exist CDEXSCS1 goto _end
goto _start
:_notagain
echo CDROM: Drivers are already loaded...
goto _autorun
:_noaspi
echo CDROM: No ASPI driver loaded
goto _abort
:_nodrv
echo CDROM: No drivers found. Add Atapi and/or SCSI CD-Rom drivers...
goto _abort
:_noaspicd
echo CDROM: File not found: %srcdrv%\lib\aspicd.%arcext%
goto _abort
:w_cfg "Run CD or go config?" [x]
(~press any key~: #? sec.)
[!] Running CD-Rom...
[ Ok ] [ Config ] [? Abort ]
::
:w_wprot "Disable write protection..." [x]
If the disk in drive %srcdrv% is write
protected, please disable the write
protection now in order to save settings.
You can re-enable write protection after
saving.
[ Ok ] [? Cancel ]
::
:_usage
echo Parameters:
echo -c Config mode
echo -h This help info
echo.
echo _end
:_error
shift
shift
echo.
echo CDROM: Error %1 %2 %3 %4 %5 %6 %7 %8
echo.
@rem pause
goto _end
:_abort
echo CDROM: Aborted...
echo.
@rem pause
:_end
set | tfind /f1,2 "W_" >>%tmp%\_cdrom.tmp
set | tfind /f1,6 "CDROM_" >>%tmp%\_cdrom.tmp
type %tmp%\_cdrom.tmp | lmod /L* /B= set [$1]=>%tmp%\_cdrom.bat
call %tmp%\_cdrom.bat
if exist %tmp%\_cdrom.* del %tmp%\_cdrom.*
set ?=
set wcb1=
set wcb2=
set wcb3=
set wcb4=
set wcb5=
set wcb6=
set wcb7=
set wcb8=
set wcb9=
set wrb=
set wbat=